import * as BABYLON from "babylonjs"; //全部引入

// 添加图片纹理
function addImgTex(scene) {
  // 获取建筑位置  获取不到位置，位置都是(0, 0, 0)
  let lianChengBuilding = scene.getMeshByName("连城广场");
  // 平面配置项
  let planeOpts = {
    height: 0.22,
    width: 0.36,
    sideOrientation: 0
  };
  // 创建平面物体，后续给这个物体添加纹理材质
  let imgPlane = BABYLON.MeshBuilder.CreatePlane("plane", planeOpts, scene);
  // 平面物体位置参数
  let imgPos = new BABYLON.Vector3(-2.05, 0.17, -3.2).addInPlace(
    lianChengBuilding.position
  );
  imgPlane.position = imgPos;
  imgPlane.rotation.y = Math.PI / 1.4;

  let imgPlaneMat = new BABYLON.StandardMaterial("imgPlaneMat", scene);
  imgPlaneMat.diffuseTexture = new BABYLON.Texture(
    "static/textures/adv2.png",
    scene
  );
  imgPlaneMat.emissiveColor = new BABYLON.Color3.White();
  imgPlane.material = imgPlaneMat;
}
export default addImgTex;
